package cn.marinda.listener;

import cn.marinda.gui.impl.DownloadServerDiaLogImpl;
import cn.marinda.gui.impl.OnlinePluginFilesHelperImpl;
import cn.marinda.gui.impl.OnlineServerCoreFilesHelperImpl;
import cn.marinda.util.HttpUtils;
import cn.marinda.util.ServerUtils;
import cn.marinda.util.SwingUtils;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Set;

public class DownloadOnlineServerCoreEvent implements ActionListener {

    private JComboBox jComboBox;
    private JButton button;

    public DownloadOnlineServerCoreEvent(JComboBox jComboBox,JButton button){
        this.jComboBox = jComboBox;
        this.button = button;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        //        关闭窗体
        OnlineServerCoreFilesHelperImpl.instance.close();
        String coreName = jComboBox.getSelectedItem().toString();
        HttpUtils.onlineCoreName = coreName;
//        声明在线核心下载
        ServerUtils.downloadCoreFlag = true;
        SwingUtils.downloadDialog = new DownloadServerDiaLogImpl(coreName);
        SwingUtils.downloadDialog.open();
    }
}
